home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr25 / rxcalc.zip / PROGRAM6.CAL < prev    next >
Text File  |  1993-03-01  |  1KB  |  24 lines

  1. /* Rexx Calculator program 4 key - standard deviation of memory      */
  2. parse arg num                          /* get the count of memories  */
  3. numeric digits CalcPrecision()         /* set current precision      */
  4. numeric form value CalcForm()          /* set current form           */
  5.  
  6. if \datatype(num, 'Whole')             /* must be whole number       */
  7.   then return 'Error'                  /* return error indicator     */
  8.  
  9. if num < 1 | num >50                   /* valid for counter          */
  10.   then return 'Error'                  /* return error indicator     */
  11.  
  12. mean = program3(num)                   /* get the mean               */
  13.  
  14. accumulator = 0                        /* start at zero              */
  15.  
  16. do i = 1 to num                        /* loop for given number      */
  17.   'GET' i 'REGISTER'                   /* get next register          */
  18.                                        /* add to total               */
  19.   accumulator = accumulator + (register - mean)**2
  20. end
  21.  
  22.                                        /* return standard deviation  */
  23. return program2(accumulator / (num - 1))
  24.